<template>
    <div>
        <van-nav-bar title="会员注册" left-arrow @click-left="() => { $router.push('/') }" />
    </div>
    <div>
        <van-form @submit="onSubmit">
            <van-cell-group inset>
                <van-field v-model="username" name="username" label="账号" placeholder="请输入账号(必填)"
                    :rules="[{ required: true, message: '请填写用户名' }]" />
                <van-field v-model="password" type="password" name="password" label="密码" placeholder="请输入密码(必填)"
                    :rules="[{ required: true, message: '请填写密码' }]" />
                <van-field v-model="password" type="password" name="password" label="密码" placeholder="请输入确认密码(必填)"
                    :rules="[{ required: true, message: '请填写确认密码' }]" />
                <van-field v-model="name" type="name" name="name" label="姓名" placeholder="请输入姓名(必填)"
                    :rules="[{ required: true, message: '请填写姓名' }]" />
                <van-field v-model="YouX" type="YouX" name="YouX" label="邮箱" placeholder="请输入邮箱(必填)"
                    :rules="[{ required: true, message: '请填写邮箱' }]" />
                <van-field v-model="ShouJH" type="ShouJH" name="ShouJH" label="手机号" placeholder="请输入手机号(必填)"
                    :rules="[{ required: true, message: '请填写手机号' }]" />
                <van-field v-model="LiuY" type="LiuY" name="LiuY" label="留言" placeholder="请输入留言" />
            </van-cell-group>
            <van-form @failed="onFailed">
            </van-form>
            <div style="margin: 16px;">
                <van-button round block type="primary" native-type="submit"
                    style="border-radius: 5px; background-color: red; border: none;font-size: 20px;">
                    注册
                </van-button>
            </div>
        </van-form>
    </div>
</template>

<script setup>
import { ref } from 'vue';

const username = ref('');
const password = ref('');
const name = ref('')
const YouX = ref('')
const ShouJH = ref('')
const LiuY = ref('')
const onSubmit = (values) => {
    console.log('submit', values);
};
import {registerApi} from '@/api/api';
registerApi().then(res=>
{
    console.log('注册数据',res);
})
</script>

<style lang="scss" scoped>
div {
    .van-field {
        margin-top: 20px;
    }
}
</style>